var deviceone = require("deviceone");
var page = sm("do_Page");
var app = sm("do_App");

var rootview = ui("$");
var buttonA = mm("do_Animation", "BUTTONTOUCHDOWNS", "app");
var param = {oneCategory:[],oneSelected:{}};

//遮罩显示
var animMaskShow = mm("do_Animator");
var propsMS = {bgColor:"00000077"};
animMaskShow.append(300,propsMS,"EaseOut");
//面板显示
var animPanelShow = mm("do_Animator");
var propsPS = {y:260};
animPanelShow.append(300,propsPS,"Linear");
//遮罩隐藏
var animMaskHide = mm("do_Animator");
var propsMH = {bgColor:"00000000"};
animMaskHide.append(300,propsMH,"EaseIn");
//面板隐藏
var animPanelHide = mm("do_Animator");
var propsPH = {y:960};
animPanelHide.append(300,propsPH,"EaseIn");

//遮罩事件
var maskbg = ui("bgmask");
maskbg.on("touch","",300,function(){});
//防止穿透
var bodyp = ui("pbody");
bodyp.on("touch","",300,function(){});
//确定  
var buttonSure = ui("buttonSure");
buttonSure.on("touch","",300,function(){
	maskbg.animate(animMaskHide,function(){
		maskbg.visible = false;
	});
	bodyp.animate(animPanelHide);
});
var buttonCancle = ui("buttonCancle");
buttonCancle.on("touch","",300,function(){
	maskbg.animate(animMaskHide,function(){
		maskbg.visible = false;
	});
	bodyp.animate(animPanelHide);
});
//zdy
function uploadBox(data){
	maskbg.visible = data;
	maskbg.animate(animMaskShow);
	bodyp.animate(animPanelShow);
}
page.on("uploadBox",function(data){
	maskbg.visible = data;
	maskbg.animate(animMaskShow);
	bodyp.animate(animPanelShow);
});
var uploadList = ui("uploadList");
var uploadData = mm("do_ListData");
function uploadBoxList(data){
	uploadData.removeAll();
	uploadList.bindItems(uploadData);
	uploadData.addData(data);
	uploadList.refreshItems();
}
page.on("uploadBoxList",function(data){
	uploadData.removeAll();
	uploadList.bindItems(uploadData);
	uploadData.addData(data);
	uploadList.refreshItems();
});
var mTimer = mm("do_Timer", "timer4upgrade", "app");
mTimer.delay = 0;
mTimer.interval = 1000;
var maxVal = 6;
buttonCancle.text=maxVal+"秒后关闭"
if (!mTimer.isStart()) {
    mTimer.start();
}
mTimer.on("tick", function(data,e) {
	buttonCancle.text=maxVal+"秒后关闭"
    if (maxVal <= 0) {
    	mTimer.stop();
    	maskbg.animate(animMaskHide,function(){
    		maskbg.visible = false;
    	});
    	bodyp.animate(animPanelHide);
    }
	maxVal--;
});